package com.cuit.blog.entity;

import java.util.Date;

import jakarta.persistence.*;

@Entity
@Table(name = "t_article")
public class Article extends BaseEntity {

    @Column(name = "title")
    private String title;

    @Column(name = "content")
    private String content;
    
    @Column(name = "pub_date")
    private Date pubDate;

    @ManyToOne(cascade=CascadeType.REFRESH,fetch=FetchType.EAGER)
    @JoinColumn(name = "articletype_id", referencedColumnName = "id")
    private Articletype articletype;

    @ManyToOne(cascade=CascadeType.REFRESH,fetch=FetchType.EAGER)
    @JoinColumn(name = "user_id", referencedColumnName = "id")
    private User user;
  
    public Article() {
    }   
    
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getPubDate() {
        return pubDate;
    }

    public void setPubDate(Date pubDate) {
        this.pubDate = pubDate;
    }

    public Articletype getArticletype() {
        return articletype;
    }

    public void setArticletype(Articletype articletype) {
        this.articletype = articletype;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
	return "Article [title=" + title + ", content=" + content + ", pubDate=" + pubDate + ", articletype="
		+ articletype + ", user=" + user + "]";
    }

}
